<?php

class Admin_Model_Options {

    private $_dbtable;

    public function __construct() {
        $this->_dbtable = new Admin_Model_DbTable_Options();
    }

    /**
     * 
     * @param type $data
     */
    public function updateAdminEmail($data) {
        $this->_dbtable->update($data, "id = 1");
    }

    /**
     * 
     * @return type
     */
    public function getAdminEmail() {
        $select = $this->_dbtable->select();
        $select->where("id = 1");
        $result = $this->_dbtable->fetchAll($select);
        $output = $result[0]['details'];
        return $output;
    }

    /**
     * 
     * @param type $data
     * @param type $id = sendgrid id
     */
    public function updateSengridDetails($data) {
        $this->_dbtable->update($data, "id = 2");
    }

    /**
     * 
     * @return type
     */
    public function getSendgridDetails() {
        $select = $this->_dbtable->select();
        $select->where("id = 2");
        $result = $this->_dbtable->fetchAll($select);
        $output = json_decode($result[0]['details'], true);
        return $output;
    }

    /**
     * 
     * @param type $data
     */
    public function updateFullOnSms($data) {
        $this->_dbtable->update($data, "id = 3");
    }

    /**
     * 
     * @return type
     */
    public function getFullOnSmsDetails() {
        $select = $this->_dbtable->select();
        $select->where("id = 3");
        $result = $this->_dbtable->fetchAll($select);
        $output = json_decode($result[0]['details'],true);
        return $output;
    }

}

